package org.example.java.util.concurrency;

import java.util.concurrent.TimeUnit;

/**
 * Created by Juntao.Zhang on 2014/8/7.
 */
public class ThreadStringTest {
  StringBuilder sb = new StringBuilder("");
//  StringBuffer sb = new StringBuffer("");

  public static void main(String[] args) {
    final ThreadStringTest t = new ThreadStringTest();
    for (int i = 0; i < 10; i++) {
      new Thread() {
        public void run() {
          for (int c = 0; c < 100; c++) {
            t.sb.append("[12345]");
          }
        }
      }.start();
    }
    try {
      TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    System.out.println(t.sb.toString());
  }
}
